package com.gitee.huanminabc.jcommon.multithreading;

import com.gitee.huanminabc.jcommon.multithreading.executor.ExecutorUtil;

import java.util.concurrent.TimeUnit;

/**
 * @description:
 * @author: huanmin
 * @create: 2025-04-28 15:01
 **/
public class DelayRun {
    //延迟指定时间执行
    public static void delayRun(long delay, TimeUnit timeUnit, Runnable runnable) {
        ExecutorUtil.newThread(()->{
            try {
                timeUnit.sleep(delay);
                runnable.run();
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
        });
    }
}
